import request from '@/utils/request'

export function getBrandList() {
	return request({
		url: "/api/brand/listAll",
		method: "GET",
	})
}

export function searchBrand(msg) {
	let query = new FormData();
	query.append("keyword", msg.keyword)
	return request({
		headers: {
			"content-type": "multipart/form-data"
		},
		url: "/api/brand/list",
		method: "POST",
		data: query
	})
}

export function createBrand(query) {
	return request({
		url: "/api/brand/create",
		method: "POST",
		data: query
	})
}

// export function deleteBrand(id) {
//   return request({
//     url: `/brand/delete/${id}`,
//     method: "POST"
//   })
// }

export function detailBrand(id) {
	return request({
		url: `/api/brand/${id}`,
		method: "POST"
	})
}

export function updateBrand(id, query) {
	return request({
		url: `/api/brand/update/${id}`,
		method: "POST",
		data: query
	})
}

export function deleteBatch(ids) {
	const query = new FormData();
	query.append("ids", ids);
	return request({
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		url: "/api/brand/delete/batch",
		method: "POST",
		data: query
	})
}


export function updateShowStatus(status, query) {
	return request({
		headers: {
			"Content-Type": "multipart/form-data"
		},
		url: "/api/brand/update/showStatus",
		method: "POST",
		params: status,
		data: query
	})
}


export function updateFactoryStatus(query) {
	return request({
		headers: {
			"Content-Type": "multipart/form-data"
		},
		url: "/api/brand/update/factoryStatus",
		method: "POST",
		data: query
	})
}
